package com.sias.realestate.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sias.realestate.web.service.UserService;
import com.sias.realestate.core.generic.GenericDao;
import com.sias.realestate.core.generic.GenericServiceImpl;
import com.sias.realestate.web.dao.UserMapper;
import com.sias.realestate.web.model.User;

@Service
public class UserServiceImpl extends GenericServiceImpl<User, Integer> implements UserService{

	@Resource
	private UserMapper usermapper;

	@Override
    public int insert(User model) {
        return usermapper.insertSelective(model);
    }

    @Override
    public int update(User model) {
        return usermapper.updateByPrimaryKeySelective(model);
    }

    @Override
    public int delete(Integer id) {
        return usermapper.deleteByPrimaryKey(id);
    }

    @Override
    public User selectById(Integer id) {
        return usermapper.selectByPrimaryKey(id);
    }
    
	@Override
	public List<User> selectList() {
		// TODO Auto-generated method stub		
		return usermapper.findAll();
	}

	@Override
	public GenericDao<User, Integer> getDao() {
		// TODO Auto-generated method stub
		return usermapper;
	}

	@Override
	public User findByUname(String uname) {
		// TODO Auto-generated method stub
		return usermapper.selectByUname(uname);
	}

}
